/*
* Copyright (C) 2021 ~ 2022 Uniontech Technology Co., Ltd.
*
* Author:      zhangbingyi <zhangbingyi@uniontech.com>
*
* Maintainer:  zhangbingyi <zhangbingyi@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "common/usbmanagercomm.h"

#include <QObject>

class USBImportAndExportJob : public QObject
{
    Q_OBJECT
public:
    explicit USBImportAndExportJob();
    ~USBImportAndExportJob();

Q_SIGNALS:

    // 通知导出全部设备的全部连接记录完成
    void exportAllDevConnectionRecordFinished();

    // 通知导出某一个设备的全部连接记录完成
    void exportOneDevConnectionRecordFinished();

    // 通知导入的白名单校验完成
    void usbWhitelistVerifySucceed(const USBConnectionInfoList &list);

    // 通知导入的白名单校验失败 -- 具体错误
    void usbWhitelistInfoVerifyFailed(int row, const QString &content);

    // 通知导入的白名单校验失败 -- 其他错误
    void importUSBWhitelistFailed();

public Q_SLOTS:

    // 导出全部连接记录
    void onExportAllDevConnetionRecord(const QString &path, const USBConnectionInfoList &list);

    // 导出某一个设备全部连接记录
    void onExportOneDevConnetionRecord(const QString &path, const USBConnectionInfoList &list);

    // 白名单下载模板
    void onExportWhitelistTemplate(const QString &path);

    // 导入白名单
    void onImportUSBWhitelist(const QString &path);

private:
    // 导出日志
    void exportConnetionRecord(const QString &path, const USBConnectionInfoList &list);
};
